package com.zb.excel.converter;

import com.alibaba.excel.constant.OrderConstant;
import com.zb.constant.WorkConstant;

/**
 * 工单转换类
 * @Author WEN
 * @Date 2023/10/12 0012
 **/
public class WorkConverter {

    /**
     * 工单状态转换
     * @param status 工单状态
     * @return
     */
    public static String workStatusConverter(Integer status) {
        if (null == status) {
            return "";
        }
        switch (status) {
            case WorkConstant.WORK_STATUS_1 -> {
                return WorkConstant.WORK_STATUS_STR_1;
            }
            case WorkConstant.WORK_STATUS_2 -> {
                return WorkConstant.WORK_STATUS_STR_2;
            }
            case WorkConstant.WORK_STATUS_3 -> {
                return WorkConstant.WORK_STATUS_STR_3;
            }
            case WorkConstant.WORK_STATUS_4 -> {
                return WorkConstant.WORK_STATUS_STR_4;
            }
            case WorkConstant.WORK_STATUS_5 -> {
                return WorkConstant.WORK_STATUS_STR_5;
            }
        }
        return "";
    }

    /**
     * 工单模块类型转换
     * @param type
     * @return
     */
    public static String moduleTypeConverter(Integer type) {
        if (null == type) {
            return "";
        }
        switch (type) {
            case WorkConstant.MODULE_TYPE_1 -> {
                return WorkConstant.MODULE_TYPE_STR_1;
            }
            case WorkConstant.MODULE_TYPE_2 -> {
                return WorkConstant.MODULE_TYPE_STR_2;
            }
            case WorkConstant.MODULE_TYPE_3 -> {
                return WorkConstant.MODULE_TYPE_STR_3;
            }
            case WorkConstant.MODULE_TYPE_4 -> {
                return WorkConstant.MODULE_TYPE_STR_4;
            }
        }
        return "";
    }

    /**
     * 工单费用或工单配件结算类型转换
     * @param type
     * @return
     */
    public static String orderFeeOrOrderSpareSettlementTypeConverter(Integer type) {
        if (null == type) {
            return "";
        }
        switch (type) {
            case WorkConstant.WORK_FEE_OR_WORK_SPARE_SETTLEMENT_TYPE_1 -> {
                return WorkConstant.WORK_FEE_OR_WORK_SPARE_SETTLEMENT_TYPE_STR_1;
            }
            case WorkConstant.WORK_FEE_OR_WORK_SPARE_SETTLEMENT_TYPE_2 -> {
                return WorkConstant.WORK_FEE_OR_WORK_SPARE_SETTLEMENT_TYPE_STR_2;
            }
        }
        return "";
    }

    /**
     * 获取工单配件申请类型
     * @param type 配件申请类型
     * @param networkSpareType 外部配件类型
     * @return
     */
    public static String getWorkSpareApplyType(Integer type, Integer networkSpareType) {
        if (null == type) {
            return "";
        }
        if (type == WorkConstant.WORK_SPARE_APPLY_TYPE_1) {
            return WorkConstant.WORK_SPARE_APPLY_TYPE_STR_1;
        }
        String typeStr = WorkConstant.WORK_SPARE_APPLY_TYPE_STR_2 + " - ";
        switch (networkSpareType) {
            case 1 -> {
                return typeStr + WorkConstant.WORK_SPARE_APPLY_OUT_TYPE_STR_1;
            }
            case 2 -> {
                return typeStr + WorkConstant.WORK_SPARE_APPLY_OUT_TYPE_STR_2;
            }
            case 3 -> {
                return typeStr + WorkConstant.WORK_SPARE_APPLY_OUT_TYPE_STR_3;
            }
        }
        return "";
    }

    /**
     * 提醒条件转换
     * @param reminderConditionType 提醒条件类型
     * @return
     */
    public static String reminderNodeConditionConverter(Integer reminderConditionType) {
        if (null == reminderConditionType) {
            return "";
        }
        switch (reminderConditionType) {
            case 1 -> {
                return "未分配客服";
            }
            case 2 -> {
                return "未派单";
            }
            case 3 -> {
                return "服务商未接单";
            }
            case 4 -> {
                return "工程师未接单";
            }
            case 5 -> {
                return "工程师未拨打电话";
            }
            case 6 -> {
                return "工程师未预约";
            }
            case 7 -> {
                return "工程师未签到";
            }
        }
        return "";
    }
}
